package com.dankegongyu.lib.common.event;

import org.greenrobot.eventbus.EventBus;

/**
 * https://github.com/greenrobot/EventBus
 *
 * @author wupuquan
 * @version 1.0
 * @since 2018/5/29 16:13
 */
public class DKEventBus {

    /**
     * 使用蛋壳自己的EventBus实例，避免创建多个的情况
     */
    private static final EventBus mEventBus = new EventBus();

    private DKEventBus() {

    }

    public static void register(Object subscriber) {
        if (subscriber != null) {
            mEventBus.register(subscriber);
        }
    }

    public static void unregister(Object subscriber) {
        if (subscriber != null) {
            mEventBus.unregister(subscriber);
        }
    }

    public static void post(Object event) {
        if (event != null) {
            mEventBus.post(event);
        }
    }
}
